package cn.droidlover.xdroidmvp.bean;

import cn.droidlover.xdroidmvp.net.IModel;

/**
 * 基础接受 Model
 * Created by jack on 2019/4/11.
 */

public class BaseModel<T> implements IModel {

    public static final int SUCCESS_CODE = 200;

    public int code;
    public String message;
    public T result;
    public String url;
    @Override
    public boolean isError() {
        return code == 500 || code == 401 || code == 400 ;
    }


    @Override
    public boolean isErrorLimits() {
        return 900 == code;
    }

    @Override
    public int getErrorCode() {
        return code;
    }

    @Override
    public String getErrorMsg() {
        return message;
    }


    @Override
    public String toString() {
        return "BaseModel{" +
                "code=" + code +
                ", message='" + message + '\'' +
                ", result=" + result +
                '}';
    }
}
